package com.cfx.exercise_44;

import java.util.LinkedList;

public class TestExer {

	public static void main(String[] args) {
		/*String str = "abcd";
		
		LinkedList<String> list = getList(str,"");
		for (String string : list) {
			System.out.println(string);
		}*/
		String str1 = "my name is zhangsan";
		StringBuffer sb = new StringBuffer(str1.length());
		for(int i = str1.length()-1;i>=0;i--){
			sb.append(str1.charAt(i));
		}
		System.out.println(sb);
		int i = 10;
		System.out.println(getDiGui(i));
	}
	
	public static LinkedList<String> getList(String str,String buff){
		LinkedList<String> res = new LinkedList<>();		
		if(str.length()<=0){
			res.add(buff);
		}
		for (int i = 0; i < str.length(); i++) {
			LinkedList<String> tem = getList(new StringBuilder(str).deleteCharAt(i).toString(), buff+str.charAt(i));
			res.addAll(tem);
		}
		
		return res;
	}
	public static int getDiGui(int i){
		if(i==0||i==1){
			return 1;
		}else{
			return i*getDiGui(i-1);
		}		
	}
}
